home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / misc / emu / ATUtilities.lha / ATUtilities / speak.c < prev    next >
C/C++ Source or Header  |  2000-09-26  |  2KB  |  70 lines

  1. #include <exec/types.h>
  2. #include <exec/memory.h>
  3. #include <devices/narrator.h>
  4.  
  5. struct Library     *TranslatorBase;
  6. struct narrator_rb *io;
  7. struct MsgPort     *port;
  8. LONG                dev=-1L;
  9. UBYTE              *mem;
  10.  
  11. UBYTE Channels[4]={3,5,10,12};
  12.  
  13. VOID Say(text)
  14.  UBYTE *text;
  15. {
  16.  io->rate=DEFRATE;
  17.  io->pitch=DEFPITCH;
  18.  io->mode=0;
  19.  io->sex=0;
  20.  io->ch_masks=&Channels;
  21.  io->nm_masks=4;
  22.  io->volume=64;
  23.  io->sampfreq=28000;
  24.  Translate(text,strlen(text),mem,1024);
  25.  
  26.  io->message.io_Command=CMD_WRITE;
  27.  io->message.io_Data=mem;
  28.  io->message.io_Length=strlen(mem);
  29.  DoIO(io);
  30. }
  31.  
  32. VOID main()
  33. {
  34.  port=CreatePort("Speak 1.0 Narrator Port",0);
  35.  if(port!=NULL)
  36.   {
  37.    io=CreateExtIO(port,sizeof(struct narrator_rb));
  38.    if(io!=NULL)
  39.     {
  40.      dev=OpenDevice("narrator.device",0,io,0);
  41.      if(dev==0)
  42.       {
  43.        TranslatorBase=OpenLibrary("translator.library",0);
  44.        if(TranslatorBase!=NULL)
  45.         {
  46.          mem=AllocMem(1024,MEMF_CLEAR|MEMF_PUBLIC);
  47.          if(mem!=NULL)
  48.           {
  49.            puts("------------ Speak -------------");
  50.            Say("l p t 1 control display opened");
  51.            Say("~~~~~ 1234567890 []{} ~~~~~");
  52.            Say("commodore amiga 2thousand");
  53.            Say("test test test");
  54.            Say("a t keyboard");
  55.            puts("--------------------------------");
  56.            FreeMem(mem,1024);
  57.           }
  58.          CloseLibrary(TranslatorBase);
  59.         }
  60.        CloseDevice(io);
  61.       }
  62.      DeleteExtIO(io);
  63.     }
  64.    DeletePort(port);
  65.   }
  66.  puts("Ende");
  67. }
  68.  
  69.  
  70.